package org.jeecg.modules.demo.huibaozhibiao.service;


import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class TimedDataGenerator {

    @Qualifier("huibaozhibiaoServiceImpl")
    @Autowired
    private IHuibaozhibiaoService huibaozhibiaoService;

    @Scheduled(cron = "0 0 22 24 * ?")
    /*
    *
    *秒 分 时 日 月 周 年（其中年可选）
    * */
    public void generateData() {
        log.info("定时任务开始执行，准备调用generateTimedData方法");
        try {
            huibaozhibiaoService.generateTimedData();
            log.info("定时任务执行成功");
        } catch (Exception e) {
            log.error("定时任务执行失败", e);
        }
    }
}

